#include "materials.h"

#include "scene.h"

Color SimpleMaterial::shade(const Vector3& p, const Vector3& n,
	const Vector3& v)
{
		return color;
}

Color DiffuseMaterial::shade(const Vector3& p, const Vector3& n,
	const Vector3& v)
{
	Color irradiance;
	
	for(uint i = 0; i < scene->lights.size(); ++i)
	{
		irradiance += scene->lights[i]->radiance(p, n); 
	}

	return irradiance * color;
}

Color MirrorMaterial::shade(const Vector3& p, const Vector3& n,
	const Vector3& v)
{
	Vector3 in = p - v;
	Ray out(p, Vector3::reflect(in, n));
	out.dir.normalize();
	//return Color(out.dir.x, out.dir.y, out.dir.z) ;
	return scene->trace(out);
}	

